import Vue from 'vue'
import Router from 'vue-router'
import { shop } from './modules/shop'
import { system } from './modules/system'
const originalPush = Router.prototype.push
Router.prototype.push = function push (location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)
let routes = [
	{
		path: '/login',
		name: 'login',
		component: () => import('@/views/login.vue'),
		meta: { title: '登录', subType: 'login' ,leftNav:''},
	},
	{
		path: '/',
		name: 'dashboard',
		component: () => import('@/views/dashboard.vue'),
		meta: { title: '控制台', subType: 'dashboard' ,leftNav:'dashboard'},
	},
	{
		path: '/404',
		name: '404',
		component: () => import('@/views/404.vue'),
		meta: { title: '404', subType: '404' ,leftNav:''},
	},
	{
		path: '*',
		redirect: '/404'
	},
	
]
export default new Router({
	linkActiveClass: 'active',
	//mode: 'history',
	routes: [
		...routes,
		...shop,
		...system
	]
})